//
//  UserRelationToolView.swift
//  maopu
//
//  Created by xiongsh on 2017/5/4.
//  Copyright © 2017年 maopu. All rights reserved.
//

import UIKit
/*
 获赞、关注、粉丝、我的资料
 */
class UserRelationToolView: UIView {
    fileprivate var labelPraise: UILabel!
    fileprivate var labelPraiseNums: UILabel!
    fileprivate var labelAttention: UILabel!
    fileprivate var labelAttentionNums: UILabel!
    fileprivate var labelFans: UILabel!
    fileprivate var labelFansNums: UILabel!
    fileprivate var labelMyInfo: UILabel!
    fileprivate var imageInfo: UIImageView!
    
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.initView()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    fileprivate func initView() {
        for index in 0...4 {
            let btnBackground:UIButton = UIButton.init(frame: CGRect.init(x: CGFloat(index) * AppWidth/4, y: 0, width: AppWidth/4, height: 60))
            btnBackground.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#ffffff")), for: .normal)
            btnBackground.setBackgroundImage(UIImage.createImageWithColor(color: UIColor.colorWithHexString(hex: "#f0f0f0")), for: .highlighted)
            self.addSubview(btnBackground)
        }
        
        for index in 0...4 {
            let lineCol: UIView = UIView.init(frame: CGRect.init(x: CGFloat(index + 1) * AppWidth/4, y: 15, width: 0.5, height: 30))
            lineCol.backgroundColor = UIColor.m_lineColor()
            self.addSubview(lineCol)
        }
        
        let viewtopLine: UIView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: AppWidth, height: 0.5))
        viewtopLine.backgroundColor = UIColor.m_lineColor()
        self.addSubview(viewtopLine)
        
        var left: CGFloat = 0.0
        let top: CGFloat = 10.0
        
        self.labelPraise = UILabel.init(frame: CGRect.init(x: left, y: top, width: AppWidth/4, height: 20))
        self.labelPraise.textAlignment = .center
        self.labelPraise.text = "获赞"
        self.labelPraise.font = UIFont.LightDefaultFont(11.0)
        self.labelPraise.textColor = UIColor.m_textLightColor()
        self.addSubview(self.labelPraise)
        
        self.labelPraiseNums = UILabel.init(frame: CGRect.init(x: left, y: top + 20, width: AppWidth/4, height: 20))
        self.labelPraiseNums.textAlignment = .center
        self.labelPraiseNums.text = "0"
        self.labelPraiseNums.font = UIFont.LightDefaultFont(15.0)
        self.labelPraiseNums.textColor = UIColor.black
        self.addSubview(self.labelPraiseNums)
        
        left += AppWidth/4
        
        self.labelAttention = UILabel.init(frame: CGRect.init(x: left, y: top, width: AppWidth/4, height: 20))
        self.labelAttention.textAlignment = .center
        self.labelAttention.text = "关注"
        self.labelAttention.font = UIFont.LightDefaultFont(11.0)
        self.labelAttention.textColor = UIColor.m_textLightColor()
        self.addSubview(self.labelAttention)
        
        self.labelAttentionNums = UILabel.init(frame: CGRect.init(x: left, y: top + 20, width: AppWidth/4, height: 20))
        self.labelAttentionNums.textAlignment = .center
        self.labelAttentionNums.text = "0"
        self.labelAttentionNums.font = UIFont.LightDefaultFont(15.0)
        self.labelAttentionNums.textColor = UIColor.black
        self.addSubview(self.labelAttentionNums)
        
        left += AppWidth/4
        
        self.labelFans = UILabel.init(frame: CGRect.init(x: left, y: top, width: AppWidth/4, height: 20))
        self.labelFans.textAlignment = .center
        self.labelFans.text = "粉丝"
        self.labelFans.font = UIFont.LightDefaultFont(11.0)
        self.labelFans.textColor = UIColor.m_textLightColor()
        self.addSubview(self.labelFans)
        
        self.labelFansNums = UILabel.init(frame: CGRect.init(x: left, y: top + 20, width: AppWidth/4, height: 20))
        self.labelFansNums.textAlignment = .center
        self.labelFansNums.text = "0"
        self.labelFansNums.font = UIFont.LightDefaultFont(15.0)
        self.labelFansNums.textColor = UIColor.black
        self.addSubview(self.labelFansNums)
        
        left += AppWidth/4
        
        self.imageInfo = UIImageView.init(frame: CGRect.init(x: left + (AppWidth/4 - 13)/2, y: top + 3, width: 13, height: 13))
        self.imageInfo.image = UIImage.init(named: "myInfo")
        self.addSubview(self.imageInfo)
        
        self.labelMyInfo = UILabel.init(frame: CGRect.init(x: left, y: top + 20, width: AppWidth/4, height: 20))
        self.labelMyInfo.textAlignment = .center
        self.labelMyInfo.text = "我的资料"
        self.labelMyInfo.font = UIFont.LightDefaultFont(12.0)
        self.labelMyInfo.textColor = UIColor.black
        self.addSubview(self.labelMyInfo)

    }
}
